package com.zenchn.dynamic;

import static com.zenchn.dynamic.TSysLoginAccessRecordDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.zenchn.model.TSysLoginAccessRecord;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;

@Mapper
public interface TSysLoginAccessRecordDynamicMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    BasicColumn[] selectList = BasicColumn.columnList(recordId, accessIp, accessTime, accessLocation, loginAccountId, loginAccount, loginRealName, operatingSystem, browser, memo);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    int insert(InsertStatementProvider<TSysLoginAccessRecord> insertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
    int insertMultiple(MultiRowInsertStatementProvider<TSysLoginAccessRecord> multipleInsertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TSysLoginAccessRecordResult")
    Optional<TSysLoginAccessRecord> selectOne(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TSysLoginAccessRecordResult", value = {
        @Result(column="record_id", property="recordId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="access_ip", property="accessIp", jdbcType=JdbcType.VARCHAR),
        @Result(column="access_time", property="accessTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="access_location", property="accessLocation", jdbcType=JdbcType.VARCHAR),
        @Result(column="login_account_id", property="loginAccountId", jdbcType=JdbcType.CHAR),
        @Result(column="login_account", property="loginAccount", jdbcType=JdbcType.VARCHAR),
        @Result(column="login_real_name", property="loginRealName", jdbcType=JdbcType.VARCHAR),
        @Result(column="operating_system", property="operatingSystem", jdbcType=JdbcType.VARCHAR),
        @Result(column="browser", property="browser", jdbcType=JdbcType.VARCHAR),
        @Result(column="memo", property="memo", jdbcType=JdbcType.VARCHAR)
    })
    List<TSysLoginAccessRecord> selectMany(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default long count(CountDSLCompleter completer) {
        return MyBatis3Utils.countFrom(this::count, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int delete(DeleteDSLCompleter completer) {
        return MyBatis3Utils.deleteFrom(this::delete, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int deleteByPrimaryKey(String recordId_) {
        return delete(c -> 
            c.where(recordId, isEqualTo(recordId_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int insert(TSysLoginAccessRecord record) {
        return MyBatis3Utils.insert(this::insert, record, TSysLoginAccessRecord, c ->
            c.map(recordId).toProperty("recordId")
            .map(accessIp).toProperty("accessIp")
            .map(accessTime).toProperty("accessTime")
            .map(accessLocation).toProperty("accessLocation")
            .map(loginAccountId).toProperty("loginAccountId")
            .map(loginAccount).toProperty("loginAccount")
            .map(loginRealName).toProperty("loginRealName")
            .map(operatingSystem).toProperty("operatingSystem")
            .map(browser).toProperty("browser")
            .map(memo).toProperty("memo")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int insertMultiple(Collection<TSysLoginAccessRecord> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, TSysLoginAccessRecord, c ->
            c.map(recordId).toProperty("recordId")
            .map(accessIp).toProperty("accessIp")
            .map(accessTime).toProperty("accessTime")
            .map(accessLocation).toProperty("accessLocation")
            .map(loginAccountId).toProperty("loginAccountId")
            .map(loginAccount).toProperty("loginAccount")
            .map(loginRealName).toProperty("loginRealName")
            .map(operatingSystem).toProperty("operatingSystem")
            .map(browser).toProperty("browser")
            .map(memo).toProperty("memo")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int insertSelective(TSysLoginAccessRecord record) {
        return MyBatis3Utils.insert(this::insert, record, TSysLoginAccessRecord, c ->
            c.map(recordId).toPropertyWhenPresent("recordId", record::getRecordId)
            .map(accessIp).toPropertyWhenPresent("accessIp", record::getAccessIp)
            .map(accessTime).toPropertyWhenPresent("accessTime", record::getAccessTime)
            .map(accessLocation).toPropertyWhenPresent("accessLocation", record::getAccessLocation)
            .map(loginAccountId).toPropertyWhenPresent("loginAccountId", record::getLoginAccountId)
            .map(loginAccount).toPropertyWhenPresent("loginAccount", record::getLoginAccount)
            .map(loginRealName).toPropertyWhenPresent("loginRealName", record::getLoginRealName)
            .map(operatingSystem).toPropertyWhenPresent("operatingSystem", record::getOperatingSystem)
            .map(browser).toPropertyWhenPresent("browser", record::getBrowser)
            .map(memo).toPropertyWhenPresent("memo", record::getMemo)
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default Optional<TSysLoginAccessRecord> selectOne(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectOne(this::selectOne, selectList, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default List<TSysLoginAccessRecord> select(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectList(this::selectMany, selectList, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default List<TSysLoginAccessRecord> selectDistinct(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectDistinct(this::selectMany, selectList, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default Optional<TSysLoginAccessRecord> selectByPrimaryKey(String recordId_) {
        return selectOne(c ->
            c.where(recordId, isEqualTo(recordId_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int update(UpdateDSLCompleter completer) {
        return MyBatis3Utils.update(this::update, TSysLoginAccessRecord, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    static UpdateDSL<UpdateModel> updateAllColumns(TSysLoginAccessRecord record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(recordId).equalTo(record::getRecordId)
                .set(accessIp).equalTo(record::getAccessIp)
                .set(accessTime).equalTo(record::getAccessTime)
                .set(accessLocation).equalTo(record::getAccessLocation)
                .set(loginAccountId).equalTo(record::getLoginAccountId)
                .set(loginAccount).equalTo(record::getLoginAccount)
                .set(loginRealName).equalTo(record::getLoginRealName)
                .set(operatingSystem).equalTo(record::getOperatingSystem)
                .set(browser).equalTo(record::getBrowser)
                .set(memo).equalTo(record::getMemo);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(TSysLoginAccessRecord record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(recordId).equalToWhenPresent(record::getRecordId)
                .set(accessIp).equalToWhenPresent(record::getAccessIp)
                .set(accessTime).equalToWhenPresent(record::getAccessTime)
                .set(accessLocation).equalToWhenPresent(record::getAccessLocation)
                .set(loginAccountId).equalToWhenPresent(record::getLoginAccountId)
                .set(loginAccount).equalToWhenPresent(record::getLoginAccount)
                .set(loginRealName).equalToWhenPresent(record::getLoginRealName)
                .set(operatingSystem).equalToWhenPresent(record::getOperatingSystem)
                .set(browser).equalToWhenPresent(record::getBrowser)
                .set(memo).equalToWhenPresent(record::getMemo);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int updateByPrimaryKey(TSysLoginAccessRecord record) {
        return update(c ->
            c.set(accessIp).equalTo(record::getAccessIp)
            .set(accessTime).equalTo(record::getAccessTime)
            .set(accessLocation).equalTo(record::getAccessLocation)
            .set(loginAccountId).equalTo(record::getLoginAccountId)
            .set(loginAccount).equalTo(record::getLoginAccount)
            .set(loginRealName).equalTo(record::getLoginRealName)
            .set(operatingSystem).equalTo(record::getOperatingSystem)
            .set(browser).equalTo(record::getBrowser)
            .set(memo).equalTo(record::getMemo)
            .where(recordId, isEqualTo(record::getRecordId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_login_access_record")
    default int updateByPrimaryKeySelective(TSysLoginAccessRecord record) {
        return update(c ->
            c.set(accessIp).equalToWhenPresent(record::getAccessIp)
            .set(accessTime).equalToWhenPresent(record::getAccessTime)
            .set(accessLocation).equalToWhenPresent(record::getAccessLocation)
            .set(loginAccountId).equalToWhenPresent(record::getLoginAccountId)
            .set(loginAccount).equalToWhenPresent(record::getLoginAccount)
            .set(loginRealName).equalToWhenPresent(record::getLoginRealName)
            .set(operatingSystem).equalToWhenPresent(record::getOperatingSystem)
            .set(browser).equalToWhenPresent(record::getBrowser)
            .set(memo).equalToWhenPresent(record::getMemo)
            .where(recordId, isEqualTo(record::getRecordId))
        );
    }
}